package xyz.eden.cloud.common.web.support.adapter.res;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.util.Collections;
import java.util.List;

/**
 * 分页信息 ResVO
 *
 * @param <T>
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class PageInfoResVO<T> {
    /**
     * 页码
     */
    private Integer pageNo;
    /**
     * 每页条数
     */
    private Integer pageSize;
    /**
     * 总数
     */
    private Long total;
    /**
     * 数据列表
     */
    private List<T> list;

    public static <C> PageInfoResVO<C> builderDefaultPage(Class<C> clazz) {
        return PageInfoResVO.<C>builder()
                .pageNo(1).pageSize(10).total(0L).list(Collections.emptyList())
                .build();
    }
}
